<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/18
 * Time: 13:14
 */

namespace app\admin\controller;


use app\admin\model\MemberGradeRule;
use app\admin\model\MemberUser;

class Member extends Base
{

    public function memberList(){
        return $this->fetch();
    }
    public function memberData($page,$limit){
        $where = input('get.where')?[['nick_name|true_name|phone','like','%'.trim(input('get.where')).'%']]:'';
        $data = MemberUser::where($where)->page($page,$limit)
            ->field('open_id',true)
            ->select()->toArray();
        $count = MemberUser::where($where)->count();
        $result = [
            'code'=>0,
            'msg'=>'返回成功',
            'count'=>$count,
            'data'=>$data
        ];
        return json($result);
    }
    //todo 会员管理暂停  商品管理

    public function gradeList(){
        return $this->fetch();
    }
    public function gradeData($page,$limit){
        $data = MemberGradeRule::page($page,$limit)->select()->toArray();
        $count = MemberGradeRule::count();
        $result = [
            'code'=>0,
            'msg'=>'返回成功',
            'count'=>$count,
            'data'=>$data
        ];
        return json($result);
    }

    public function gradeAdd(){
        if (request()->isPost()){
            $post = input('post.');

        }
        return $this->fetch();
    }





}